package socdev.mobile;

import socdev.data.Project;
import socdev.data.User;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class SocDevActivity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        User user = (User) getIntent().getExtras().get("user");
        Project project = (Project) getIntent().getExtras().get("project");
        
        
        Resources res = getResources();
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, TeamActivity.class);
        intent.putExtras(getIntent());
        
        spec = tabHost.newTabSpec("team").setIndicator("Tým", res.getDrawable(R.drawable.ic_tab_repository)).setContent(intent);
        tabHost.addTab(spec);
        
        if (project.isGithub()) {
        	intent = new Intent().setClass(this, RepositoryActivity.class);
        	intent.putExtras(getIntent());
        
        	spec = tabHost.newTabSpec("repository").setIndicator("Repozitář", res.getDrawable(R.drawable.ic_tab_repository)).setContent(intent);
        	tabHost.addTab(spec);
        
        }
        intent = new Intent().setClass(this, TasksActivity.class);
        intent.putExtras(getIntent());
        
        spec = tabHost.newTabSpec("tasks").setIndicator("Úkoly", res.getDrawable(R.drawable.ic_tab_repository)).setContent(intent);
        tabHost.addTab(spec);
        
        
    }
    
    
    
}